<?php
defined('_JEXEC') or die('Restricted access');

JHTML::_('behavior.tooltip');

?>

<script language="javascript" type="text/javascript">
    function submitbutton(pressbutton)
    {
            var form = document.adminForm;
            if (pressbutton == 'cancel') {
                    submitform( pressbutton );
                    return;
            }
    
            // do field validation
            if (form.title.value == ""){
                    alert( "<?php echo JText::_( 'Campaign must have a title.', true ); ?>" );
            } else if (form.description.value == ""){
                    alert( "<?php echo JText::_( 'Campaign must have a description.', true ); ?>" );
            } else {
                     submitform( pressbutton );
                     return;
            }
            
    }
</script>

<div id="header">
    <button type="button" onclick="submitbutton('save');window.top.setTimeout('window.parent.document.getElementById(\'sbox-window\').close()', 700);">Save</button>
    <button type="button" onclick="window.parent.document.getElementById('sbox-window').close();">Cancel</button>
</div>

<div id="title">
    <h1> Edit Campaign</h1>
</div>

<form action="index.php?option=com_letterman&view=campaign&task=save" method="POST" id="adminForm" name="adminForm" target="_parent">
    <div id="formDisplay" >
        <label for="title"><?php echo JText::_('Title');?></label><input type="text" name="title" id="title" value="<?php echo $this->campaign->title ; ?>"/><br />
        <label><?php echo JText::_('Image') ; ?></label><?php echo JHTML::_('list.images',  'image', $this->campaign->image ); ; ?><br />
        <label for="description"><?php echo JText::_('Description');?></label><textarea name="description" id="description"  cols="40" rows="10"><?php echo $this->campaign->description ; ?></textarea><br />
        <label><?php echo JText::_('Published');?></label><?php echo $this->published; ?><br />
        <label><?php echo JText::_('Access') ; ?></label><?php echo $this->access ; ?><br />
        <script language="javascript" type="text/javascript">
        if (document.forms.adminForm.image.options.value!=''){
                jsimg='../<?echo $cparams->get('image_path'); ?>/' + getSelectedValue( 'adminForm', 'image' );
        } else {
                jsimg='../images/M_images/blank.png';
        }
        document.write('<img src=' + jsimg + ' name="imagelib" width="80" height="80" border="2" alt="<?php echo JText::_( 'Preview', true ); ?>" />');
        </script> 
    </div>
    

    	<?php echo JHTML::_( 'form.token' ); ?>
        <input type="hidden" name="id" value="<?php echo $this->campaign->id ; ?>" />
        <input type="hidden" name="option" value="com_letterman" />
        <input type="hidden" name="view" value="campaign" />
        <input type="hidden" name="task" value="save" />
</form>

<div id="footer">
Letterman 2.0.0<br />
&copy; Copyright 2008 <a href="http://www.joomlatools.org" target="_blank">Joomlatools</a> - All Rights Reserved
</div>  